#include <iostream>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
using namespace std;

void func(int signo)
{
    cout << "收到了2号新号" << endl;
    exit(1);
}


int main()
{
    signal(2, func); 
    while(true)
    {
        cout << "I am running..., pid :" << getpid() << endl;
        sleep(1);
    }
    return 0;
}
